import React, { Component } from 'react'
import {Route,Switch} from 'react-router-dom' 
import Home from './pages/Home'
import About from './pages/About'//是路由组件
import Header from './components/Header'//是一般组件
import MyNavlink from './components/MyNavLink'


export default class App extends Component {

  render() {
    
    return (
      <div>
        <div className="row">
          <div className="col-xs-offset-2 col-xs-8">
            <Header/>
          </div>
        </div>

        <div className="row">
          <div className="col-xs-2 col-xs-offset-2">
            <div className="list-group">
              <MyNavlink to="/about">About</MyNavlink>
              <MyNavlink to="/home">Home</MyNavlink>
            </div>
          </div>
        </div>

        <div className='col-xs-6'>
          <div className="panel">
            <div className="panel-body">
              {/*Switch关闭路由的多重匹配功能*/}
              <Switch>
                <Route path="/about" component={About}/>
                <Route path="/home" component={Home}/>
              </Switch>
            </div>
          </div>
        </div>

      </div>
    )
  }

}
